VERSION 5.00
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmSystem_Settings 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   0  'None
   Caption         =   "System Configuration"
   ClientHeight    =   6960
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   10080
   LinkTopic       =   "Form1"
   ScaleHeight     =   6960
   ScaleWidth      =   10080
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Tag             =   "Settings"
   Begin MSDataGridLib.DataGrid dtgList 
      Height          =   6900
      Left            =   30
      TabIndex        =   0
      Tag             =   "."
      Top             =   15
      Width           =   10020
      _ExtentX        =   17674
      _ExtentY        =   12171
      _Version        =   393216
      AllowUpdate     =   -1  'True
      BackColor       =   16777215
      HeadLines       =   2
      RowHeight       =   15
      FormatLocked    =   -1  'True
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   7
      BeginProperty Column00 
         DataField       =   "cCode"
         Caption         =   "Code"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   "cDesc"
         Caption         =   "Description"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column02 
         DataField       =   "cType"
         Caption         =   "Type"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column03 
         DataField       =   "cValue"
         Caption         =   "Value"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column04 
         DataField       =   "cPrefix"
         Caption         =   "Prefix"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column05 
         DataField       =   "cSuffix"
         Caption         =   "Suffix"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column06 
         DataField       =   "nCount"
         Caption         =   "Count"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
            ColumnWidth     =   1665.071
         EndProperty
         BeginProperty Column01 
            ColumnWidth     =   2340.284
         EndProperty
         BeginProperty Column02 
            ColumnWidth     =   1574.929
         EndProperty
         BeginProperty Column03 
            ColumnWidth     =   1679.811
         EndProperty
         BeginProperty Column04 
            ColumnWidth     =   884.976
         EndProperty
         BeginProperty Column05 
            ColumnWidth     =   764.787
         EndProperty
         BeginProperty Column06 
            ColumnWidth     =   794.835
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "frmSystem_Settings"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'----------------------------------------------------------------------------------------------------------------------------------
'Standard Programming Format----------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------------------------------------------------

Dim cnHeader As New Connection
Dim rsHeader As New Recordset
Dim tmpObj As Object

Dim sBit() As Boolean
Dim vBookmark As Variant

Public mode As eMode

Private Sub DataOtherBind()
    Set dtgList.DataSource = rsHeader
End Sub

Public Sub TBNew()
    mode = AddEditNew
    
    If rsHeader.State <> 1 Then
        TranConnect cnHeader
        TranRecordset Mid$(Me.Name, 4, Len(Me.Name)), rsHeader, cnHeader, "1=0"
        
        DataSourceBind rsHeader, Me
        DataFieldBind rsHeader, Me
        DataOtherBind
    End If
    
    ControlObjects Me
    BitEnable sBit, Me, oMDI
    
    rsHeader.AddNew
    
    
    RSDisconnectCN rsHeader
    
End Sub

Public Sub TBEdit()
    mode = AddEditNew
    
    ControlObjects Me
    
    RSDisconnectCN rsHeader
    
    BitEnable sBit, Me, oMDI
End Sub

Public Sub TBDelete()
    On Error GoTo ErrHandler
    
    Dim sID As String
    
    RSConnectCN rsHeader, cnHeader
    
    sID = rsHeader!cTranNo
    
    If MsgBox("Are you sure you want to delete this record?", vbQuestion + vbYesNo, ProjectVersion) = vbNo Then Exit Sub
    
    AuditLog Mid$(Me.Name, 4, Len(Me.Name)), Trim(rsHeader!cCode), "Deleted"
    rsHeader.Delete adAffectCurrent
    
    rsHeader.UpdateBatch adAffectAll
    
    TBPrevious
    mode = Normal
    
    If rsHeader.RecordCount = 0 Then
        ClearDataValue Me
    Else
        vBookmark = rsHeader.Bookmark
        DataUnbind Me
        DataSourceBind rsHeader, Me
        DataFieldBind rsHeader, Me
        rsHeader.Bookmark = vBookmark
    End If
    
    BitEnable sBit, Me, oMDI

ErrHandler:
    If Err.Number = -2147217885 Then
        Resume Next
    ElseIf Err.Number = -2147217864 Or Err.Number = -2147217887 Then
        cn.Execute "DELETE " & Mid$(Me.Name, 4, Len(Me.Name)) & "_D WHERE cTranNo = '" & sID & "' AND cCompID = '" & sCompanyID & "'"
        cn.Execute "DELETE " & Mid$(Me.Name, 4, Len(Me.Name)) & " WHERE cTranNo = '" & sID & "' AND cCompID = '" & sCompanyID & "'"
        Resume Next
    End If

End Sub

Public Sub TBSave()
    On Error GoTo ErrHandler
    Dim lNew As Boolean
    
    mode = Find
    If rsHeader.Status = adRecNew Then lNew = True
    If MandatoryOK(Me) = False Then Exit Sub
    
    RSConnectCN rsHeader, cnHeader

    cn.BeginTrans
    cnHeader.BeginTrans
    
    rsHeader.UpdateBatch adAffectAll
   
    cn.CommitTrans
    cnHeader.CommitTrans
    
    Set FrmName = Me
    mode = Normal
    ControlObjects Me
    
    AuditLog Mid$(Me.Name, 4, Len(Me.Name)), rsHeader!cCompID, IIf(lNew, "Add Record", "Modify Record")
    MsgBox "Record/s successfully saved.", vbInformation, ProjectVersion
    
    BitEnable sBit, Me, oMDI
ErrHandler:
    If Err.Number = -2147168237 Then
        rsHeader.CancelBatch adAffectCurrent
        cnHeader.RollbackTrans
    ElseIf Err.Number <> 0 Then
        MsgBox Err.Description, vbCritical, ProjectVersion
    End If
End Sub

Public Sub TBUndo()
    mode = Normal
    
    If rsHeader.Status = adRecNew Then
        rsHeader.CancelUpdate
    Else
        rsHeader.CancelBatch adAffectCurrent
    End If
        
    DataUnbind Me
    If rsHeader.RecordCount = 0 Then
        ClearDataValue Me
        rsHeader.Close
        mode = Find
    Else
        DataSourceBind rsHeader, Me
        DataFieldBind rsHeader, Me
        DataOtherBind
    End If
    
    ControlObjects Me
    BitEnable sBit, Me, oMDI
End Sub

Public Sub TBFind()
    Dim sCond As String
    
    If mode = Find Then
        mode = Normal
        
        sCond = GetSearchString(Me)
        TranConnect cnHeader
        TranRecordset Mid$(Me.Name, 4, Len(Me.Name)), rsHeader, cnHeader, sCond
        
        DataSourceBind rsHeader, Me
        DataFieldBind rsHeader, Me
        DataOtherBind
        
        RSDisconnectCN rsHeader
               
    Else
        mode = Find
        rsHeader.Close
        DataUnbind Me
        ClearDataValue Me
    End If
    
    ControlObjects Me
    BitEnable sBit, Me, oMDI
End Sub

Public Sub TBPrint()
    PrintReceipt Mid$(Me.Name, 4, Len(Me.Name)), rsHeader!cTranNo
End Sub

Public Sub TBFirst()
    FirstRecord rsHeader
End Sub

Public Sub TBPrevious()
    PreviousRecord rsHeader
End Sub

Public Sub TBNext()
    NextRecord rsHeader
End Sub

Public Sub TBLast()
    LastRecord rsHeader
End Sub

Public Sub TBNewLine()
    
End Sub

Public Sub TBDeleteLine()

End Sub

Public Sub TBApprove()

End Sub

Public Sub TBReject()

End Sub

Public Sub TBUntag()

End Sub

Public Sub TBClose()
    On Error Resume Next
    Set FrmName = Nothing
    Unload Me
End Sub

Public Sub TBReload()
    Me.ZOrder
    Set FrmName = Me
    BitEnable sBit, Me, oMDI
End Sub

Private Sub Form_Click()
    TBReload
End Sub

Private Sub Form_Load()
    GetAccessLevel oMDI.tbMain, sUserRole, Me.Name, sBit()
    mode = Find
        
    BitEnable sBit, Me, oMDI
End Sub
 

